package com.redsoil.house.widget.bottombar;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;

import com.redsoil.house.R;
import com.zhy.autolayout.AutoLinearLayout;

/**
 * Created by weidingqiang on 2018/12/19.
 */

public class MatterBottomBar extends AutoLinearLayout implements View.OnClickListener{

    private MatterBottomBarItem matter_key_point;

    private MatterBottomBarItem matter_lock;

    private MatterBottomBarItem matter_sure;

    private MatterBottomBarItem matter_delete;

    private MatterBottomBarImp matterBottomBarImp;

    public void setMatterBottomBarImp(MatterBottomBarImp matterBottomBarImp) {
        this.matterBottomBarImp = matterBottomBarImp;
    }

    public MatterBottomBar(Context context) {
        this(context, null);
    }

    public MatterBottomBar(Context context, AttributeSet attrs) {
        super(context, attrs);

        LayoutInflater inflater = LayoutInflater.from(context);
        inflater.inflate(R.layout.matter_bottom_bar, this, true);

        matter_key_point = (MatterBottomBarItem) this.findViewById(R.id.matter_key_point);
        matter_lock = (MatterBottomBarItem) this.findViewById(R.id.matter_lock);
        matter_sure = (MatterBottomBarItem) this.findViewById(R.id.matter_sure);
        matter_delete = (MatterBottomBarItem) this.findViewById(R.id.matter_delete);

        matter_key_point.setOnClickListener(this);
        matter_lock.setOnClickListener(this);
        matter_sure.setOnClickListener(this);
        matter_delete.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        if(matterBottomBarImp == null)
            return;
        switch (v.getId()){
            case R.id.matter_key_point:
                matterBottomBarImp.keyPointBottom();
                break;
            case R.id.matter_lock:
                matterBottomBarImp.lockBottom();
                break;
            case R.id.matter_sure:
                matterBottomBarImp.sureBottom();
                break;
            case R.id.matter_delete:
                matterBottomBarImp.deleteBottom();
                break;

        }

    }
}
